#ifndef MEMBERSHIPHISTORY_H
#define MEMBERSHIPHISTORY_H

#include <string>
#include <ctime>
#include <iostream>
#include "CsvRow.h"

class MembershipHistory
{
public:
  MembershipHistory(const std::string& id, const std::string& memberId, const std::string& committeeId,
    time_t entryDate, time_t exitDate):
    m_id(id),
    m_memberId(memberId),
    m_committeeId(committeeId),
    m_entryDate(entryDate),
    m_exitDate(exitDate)
  {
  }

  MembershipHistory():
    m_entryDate(0),
    m_exitDate(0)
  {
  }

  virtual ~MembershipHistory()
  {
  }

  const std::string id() const { return m_id; }
  const std::string memberId() const { return m_memberId; }
  const std::string committeeId() const { return m_committeeId; }
  time_t entryDate() const { return m_entryDate; }
  time_t exitDate() const { return m_exitDate; }

  bool empty() const 
  {
    return m_id.empty() &&
      m_memberId.empty() &&
      m_committeeId.empty() &&
      m_entryDate == 0 &&
      m_exitDate == 0;
  }

  MembershipHistory& operator=(const MembershipHistory& other);

  bool operator==(const MembershipHistory& other) const;

private:
  std::string m_id;
  std::string m_memberId;
  std::string m_committeeId;
  time_t m_entryDate;
  time_t m_exitDate;
};

std::ostream& operator<<(std::ostream& stream, const MembershipHistory &history);
std::istream& operator>>(std::istream& stream, MembershipHistory& committee);

#endif // MEMBERSHIPHISTORY_H